package com.wish233.server.impl;

import com.wish233.server.WRpcServer;
import io.vertx.core.Vertx;

/**
 * @author WHH
 */
public class VertxHttpServer implements WRpcServer {
    @Override
    public void start(int port) {
        Vertx vertx = Vertx.vertx();
        io.vertx.core.http.HttpServer httpServer = vertx.createHttpServer();
        httpServer.requestHandler(new HttpServerHandler());
        httpServer.listen(port, result -> {
            if (result.succeeded()) {
                System.out.println("开始监听端口:" + port);
            } else {
                System.out.println("服务器启动失败" + result.cause());
            }
        });
    }
}
